# 抽象产品类
class Product:
    def operation(self):
        raise NotImplementedError("Subclasses must implement this!")

# 具体产品A类
class ConcreteProductA(Product):
    def operation(self):
        return "Result of the ConcreteProductA"

# 具体产品B类
class ConcreteProductB(Product):
    def operation(self):
        return "Result of the ConcreteProductB"

# 工厂类
class Factory:
    @staticmethod
    def create_product(product_type):
        if product_type == 'A':
            return ConcreteProductA()
        elif product_type == 'B':
            return ConcreteProductB()
        else:
            raise ValueError("Unknown product type")

# 测试代码
if __name__ == "__main__":
    product_a = Factory.create_product('A')
    print(product_a.operation())  # 输出: Result of the ConcreteProductA

    product_b = Factory.create_product('B')
    print(product_b.operation())  # 输出: Result of the ConcreteProductB